package cn.senwill.controller;

import cn.senwill.domain.Result;
import cn.senwill.service.AccountService;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping(value = "/api/account") // 类级别的映射
public class AccountController {

    private AccountService accountService;

    @Autowired
    public void setAccountService(AccountService accountService) {
        this.accountService = accountService;
    }

    /**
     * 更新账户
     * {
     *     "user_id": 1,
     *     "used": 1000.00
     * }
     * @param jsonObject
     * @return
     */
    @PostMapping(value = "update")
    @ResponseBody
    public Result update(@RequestBody JSONObject jsonObject) {
        return accountService.update(jsonObject);
    }
}
